Skip to content

[SPARK-52082][PYTHON][DOCS] Improve ExtractPythonUDF docs - #50867

Closed
benrobby wants to merge 1 commit into
apache:masterfrom
benrobby:SPARK-52082
Closed

benrobby wants to merge 1 commit into
apache:masterfrom
benrobby:SPARK-52082

Conversation

@benrobby

Copy link
Copy Markdown

What changes were proposed in this pull request?

  • renames two methods in ExtractPythonUDFs, and adds docstrings explaining the parallel fusing and chaining concepts

Why are the changes needed?

  • in my experience, new developers find the planning code hard to understand without sufficient explanations. The current method naming is confusing, as the canChainUDF is actually used select eligibility to fuse parallel udf invocations like udf1(), udf2().

Does this PR introduce any user-facing change?

  • No

How was this patch tested?

  • Existing tests

Was this patch authored or co-authored using generative AI tooling?

No

@benrobby

Copy link
Copy Markdown
Author

Hi @ueshin, could you take a look at this minor change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @benrobby thanks for improving the docstring. Shall we leave the method name unchanged? Since we have no change on the underlying logic of these methods.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi allison, it's true that this doesn't modify the logic, but I think that canEvaluateInPython is quite confusing. All UDFs here are eventually evaluable in Python, but it's in fact called recursively to find the first udf expression that needs to be extracted. So I think i would prefer to keep the name, unless you have strong objections

@xinrong-meng

Copy link
Copy Markdown
Member

Would you add "[DOCS]" to the PR title? Thanks!

@HyukjinKwon HyukjinKwon changed the title [SPARK-52082][PYTHON] Improve ExtractPythonUDF docs [SPARK-52082][PYTHON][DOCS] Improve ExtractPythonUDF docs May 28, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the term chain makes more sense because they are chained in Python workers when they are executed. Fuse sounds more like merging multiple functions into one function

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say both belows are examples unless we're absolutely sure that both are the only cases.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chaining Let's don't mix the wording with fusing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've renamed this to parallel chaining and nested chaining. Hope this this is more clear!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is a little bit hard to follow. Would be much easier if we can put some ascii blocks and explanation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a little query plan, hope this helps

@HyukjinKwon HyukjinKwon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense in general. Let's keep the wording consistent, e.g., udf -> UDF. Would be much easier to read if we can put some ASCII blocks. e.g., see EvalPythonExec's ScalaDoc.

@benrobby

Copy link
Copy Markdown
Author

Thanks @HyukjinKwon, i hope that i have addressed your comments and suggestions

@HyukjinKwon HyukjinKwon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. cc @allisonwang-db @ueshin

@HyukjinKwon

Copy link
Copy Markdown
Member

Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants